events: Make proximity and scroll events have tools
authorMatthias Clasen <mclasen@redhat.com>
Fri, 14 Feb 2020 21:46:43 +0000 (16:46 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 15 Feb 2020 14:44:34 +0000 (09:44 -0500)
The Wayland backend tries to set device tools on these
events, and it was just an oversight that they don't
carry them.

gdk/gdkevents.c
gdk/gdkeventsprivate.h

index 4db6aea8cc736f21ed9c70f5aa647471f768633d..b403f5da2bd2d9ba5a350a8cdd3650b7ba5fb638 100644 (file)
@@ -707,6 +707,15 @@ gdk_event_finalize (GObject *object)
       g_list_free_full (event->motion.history, g_free);
       break;
 
+    case GDK_PROXIMITY_IN:
+    case GDK_PROXIMITY_OUT:
+      g_clear_object (&event->proximity.tool);
+      break;
+
+    case GDK_SCROLL:
+      g_clear_object (&event->scroll.tool);
+      break;
+
     default:
       break;
     }
@@ -1834,6 +1843,11 @@ gdk_event_get_device_tool (const GdkEvent *event)
     return event->button.tool;
   else if (event->any.type == GDK_MOTION_NOTIFY)
     return event->motion.tool;
+  else if (event->any.type == GDK_PROXIMITY_IN ||
+           event->any.type == GDK_PROXIMITY_OUT)
+    return event->proximity.tool;
+  else if (event->any.type == GDK_SCROLL)
+    return event->scroll.tool;
 
   return NULL;
 }
@@ -1854,6 +1868,11 @@ gdk_event_set_device_tool (GdkEvent      *event,
     g_set_object (&event->button.tool, tool);
   else if (event->any.type == GDK_MOTION_NOTIFY)
     g_set_object (&event->motion.tool, tool);
+  else if (event->any.type == GDK_PROXIMITY_IN ||
+           event->any.type == GDK_PROXIMITY_OUT)
+    g_set_object (&event->proximity.tool, tool);
+  else if (event->any.type == GDK_SCROLL)
+    g_set_object (&event->scroll.tool, tool);
 }
 
 void
index fe9b80a7f8ab3de10b7cad6fd2b39bcc611c6ecc..191fcb2f4d10a9cf19949a727573e404f8a711f6 100644 (file)
@@ -231,6 +231,7 @@ struct _GdkEventScroll
   gdouble delta_x;
   gdouble delta_y;
   guint is_stop : 1;
+  GdkDeviceTool *tool;
 };
 
 /*
@@ -370,6 +371,7 @@ struct _GdkEventProximity
 {
   GdkEventAny any;
   guint32 time;
+  GdkDeviceTool *tool;
 };
 
 /*